package com.power.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.power.domain.SysUserRole;
import com.power.mapper.SysUserRoleMapper;
import com.power.service.SysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService{
    @Autowired
    private SysUserRoleMapper sysUserRoleMapper;
    @Override
    public void updateBySysUserId(Long userId, Long roleId) {
        sysUserRoleMapper.updateBySysUserId(userId,roleId);
    }

    @Override
    public void deleteByUserId(List<Long> collect) {

        sysUserRoleMapper.deleteByUserId(collect);
    }

    @Override
    public void deleteByUserIdOne(Long userId) {
        int delete = sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
    }
}
